package com.didispace.TestngReport;

import com.didispace.domain.ConfigAttribute;
import com.didispace.service.AddCaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.Reporter;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import static org.testng.Assert.assertEquals;

//import com.didispace.redis.RedisService;




@SpringBootTest
public class ReportTest extends AbstractTestNGSpringContextTests {
	@Autowired(required=true)
	AddCaseService addCaseService;

	@Autowired(required=true)
	ConfigAttribute configAttribute;
	
//	@Autowired
//	RedisService redisService;
//	
	
	@DataProvider(name = "createData")
  public Iterator<Object[]> createData(){
      List<Object[]> dataProvider = new ArrayList<Object[]>();
      for (int i=0;i<2;i++){
          String[] s = {String.format("this is one",i)};
          dataProvider.add(s);
      }
      return  dataProvider.iterator();
  }

    @Test
    public void addCase() {
    	System.out.println(addCaseService);
    	boolean b=addCaseService.SaveCase("asdasd", "dqwdqwdwqd", "qwdqwdqwd", "qwdwdqdqwd", "qwdqwdqwd","");
    	assertEquals(b, true);	
    	Reporter.log("我想看看我是写在哪的");
    } 
    
    
    @Test
    public void TestRedis() {
    	System.out.println(addCaseService);
    	boolean b=addCaseService.SaveCase("asdasd", "dqwdqwdwqd", "qwdqwdqwd", "qwdwdqdqwd", "qwdqwdqwd","");
    	assertEquals(b, true);	
    	Reporter.log("我想看看我是写在哪的");
    } 
    
//    @Test
//    public void RunnerOpenInvoiceXML() {
// //   	redisService.setStr("fplx", "0");
//    	String RqsMessage="";
//    	try {
//    		RqsMessage=new XmlUtils().getSendToTaxXMLNow(Utils.dfxj1001);
//    	}catch(Exception e) {
//    		System.out.println(e.getMessage());
//    	}
//    	
//    	String result = RequestUtils.webServiceAxis(RqsMessage,configAttribute.xmlmethod,configAttribute.url+configAttribute.requestUrlMethod_xml);
//    	
//    	assertEquals("", result);
//    	
//    	/*
//    	*
//    	*断言判断之后把发票代码号码都存入到redis中
//    	*
//    	*/
//    	
//    	
//    }
//    
//    @Test
//    public void RunnerOpen_fsInvoiceXML() {
// //   	redisService.setStr("fplx", "1");
//    	String RqsMessage="";
//    	try {
//    		RqsMessage=new XmlUtils().getSendToTaxXMLNow(Utils.dfxj1001);
//    	}catch(Exception e) {
//    		System.out.println(e.getMessage());
//    	}
//    	
//    	String result = RequestUtils.webServiceAxis(RqsMessage,configAttribute.xmlmethod,configAttribute.url+configAttribute.requestUrlMethod_xml);
//    	
//    	assertEquals("", result);
//    	
//    	/*
//    	*断言判断之后把发票代码号码都存入到redis中
//    	*/
//    	
//    	
//    }
    
    
}
